<?php $ajax = $_POST['ajax']; ?>

	
			

<?php if ($ajax == ''): ?>
<?php get_header(); ?>

			<div id="content" role="main">
				<div id="posts">
<?php endif;?>				
				<?php if ( have_posts() ) : ?>
					<?php 
					
					/* Start the Loop */ 
					?>
					<?php while ( have_posts() ) : the_post(); ?>
					<?php 
						$post_id = get_the_ID();
						$views = get_post_meta($post_id, 'views', true);
						if ($views == '') {
							add_post_meta($post_id, 'views', 1, true);
							$views = 1;
						} 
						/* else {
							$views++;
							update_post_meta($post_id, 'views', $views);
						} */
					?>
						<article class="post" id="post-<?php echo $post_id; ?>" views="<?php echo $views;?>">
							<?php 
							echo '<a class="thumb" href="'.get_permalink().'" title="'.get_the_title().'">';
							the_thumb(130,100); 
							echo '</a>';
							?>
							<h1 class="title"><?
							echo '<a href="'.get_permalink().'" title="'.get_the_title().'">'.get_the_title().'</a>';
							?></h1>
							
							<? if (0) : ?>
								<div class="body">
								<? echo get_snip(get_the_content('')); ?>
								</div>
							<? endif; ?>
							
							<div class="info">
								<i><?php echo $views;?> ng&#432;&#7901;i &#273;&#227; &#273;&#7885;c . </i>
								<em></em>
								<date><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?></date>
							</div>			
							<?php edit_post_link();?>			
						</article>
					<?php endwhile; ?>
	
	
				<?php else : ?>
					<?php if ($ajax == ''): ?>	
					<article id="post-0" class="post no-results not-found">
						<header class="entry-header">
							<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
						</header><!-- .entry-header -->
	
						<div class="entry-content">
							<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
							<?php get_search_form(); ?>
						</div><!-- .entry-content -->
					</article><!-- #post-0 -->
					<?php else: ?>
					No post
					<?php endif; ?>
				<?php endif; ?>
				
				
<?php if ($ajax == ''): ?>				
				<?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
				</div>
				
				<div class="clear"></div>
			</div><!-- #content -->
			
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/index.js"></script>
		
<?php get_footer(); ?>
<?php endif;?>